package servlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class BaseServlet extends InitServlet{

    //userServlet >>  add del

    public void execute(HttpServletRequest request, HttpServletResponse response) throws InvocationTargetException, IllegalAccessException {

        try{
            String opr=request.getParameter("opr");

            Method method=this.getClass().getDeclaredMethod(opr,HttpServletRequest.class,HttpServletResponse.class);

            method.invoke(this,request,response);

        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        }

    }
}
